from PySide6.QtWidgets import QApplication,QWidget,QComboBox,QVBoxLayout


class MyWindow(QWidget):
    def __init__(self):
        super().__init__()

        cb = QComboBox()
        cb.addItems(['北京','上海','深圳'])

        mainlayout = QVBoxLayout()
        mainlayout.addWidget(cb)
        self.setLayout(mainlayout)

        cb.currentIndexChanged.connect(lambda:print(cb.currentText()))
        cb.currentTextChanged.connect(lambda:print(cb.currentIndex()))

if __name__ == "__main__":
    app = QApplication([])
    my_window = MyWindow()
    my_window.show()
    app.exec()